package com.seo.controller.proxy.transaction;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.seo.pojo.ReturnBody;
import com.seo.service.proxy.recharge.sdk.ProxyRechargeService;
import com.seo.service.user.recharge.sdk.RechargeService;
import com.seo.utils.ClientConst;
import com.seo.utils.CommonUtil;
import com.seo.utils.Jurisdiction;

import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName: RechargeController
 * @author sbl
 * @version 2018.07.28 12:20
 */
@Slf4j
@Controller
@RequestMapping(value = "/proxy/recharge/")
public class ProxyRechargeController {

	@Autowired
	private ProxyRechargeService proxyRechargeService;

	/**
	 * 充值明细
	 * 
	 * @param params
	 *            params
	 * @param request
	 *            request
	 * @return String
	 */
	@RequestMapping(value = "/list")
	public String list(@RequestParam Map<String, Object> params, HttpServletRequest request) throws Exception {
		String tradeId = CommonUtil.getUUID();
		log.info("[{}]-充值明细[{}]", tradeId, params);
		Integer userId = Jurisdiction.getT("id", Integer.class, ClientConst.SESSION_PROXY_USER);
		params.put("proxyUserId", userId);
		ReturnBody rb = proxyRechargeService.getProxyRechargeDetailList(tradeId, params);

		if (rb.isSuccess()) {
			request.setAttribute("page", rb.get("page"));
		}
		request.setAttribute("result", rb.getResult());
		return "proxy/transaction/recharge_list";
	}


}
